package com.seven.restaurant.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.seven.restaurant.annotation.ExistId;
import com.seven.restaurant.mapper.FoodMapper;
import com.seven.restaurant.mapper.OrderMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Min;
import java.io.Serializable;

/**
 * <p>
 * 
 * </p>
 *
 * @author BaiBan
 * @since 2022-07-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("Order_item")
public class OrderItemPO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键项id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 订单id
     */
    @ExistId(value = OrderMapper.class, message = "订单不存在")
    private Long OrderId;

    /**
     * 菜名id
     */
    @ExistId(value = FoodMapper.class, message = "菜品不存在")
    private Long FoodId;

    /**
     * 数量
     */
    @Min(value = 1, message = "数量不能少于1个")
    private Integer number;
}
